package helloworld;
import java.util.Random;

import jade.core.behaviours.Behaviour;

public class IndividualBehaviour extends Behaviour {
	Random random = new Random();
	private boolean finished = false;

	
	public void action(int strAnz) {
//		while (!finished){
//			if (Math.random() > 0.99) {
//				finished = true;
//				System.out.println("Last execution");
//			}
//			else System.out.println("Repeat randomized");
//		}
		
		//Looseragent
//		int stopp = 0;
		while (!finished){
			int zieheStr = 1 + random.nextInt(3);
//			System.out.println("zieheStr: " + zieheStr + " , strAnz: " + strAnz);
			if (zieheStr <= strAnz){
//				if (stopp==3) finished = true;
//				stopp++;
				finished = true;
				System.out.println("Ich ziehe "+zieheStr+" Streichhoelzer.");
			}
			else System.out.println("Muss nochmal drueber nachdenken.");
		}
	}

	@Override
	public boolean done() {
		return finished;
	}

	@Override
	public void action() {
		// TODO Auto-generated method stub
		
	}

}
